home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / lotus1.arc / UNIT123.PAS < prev   
Pascal/Delphi Source File  |  1991-04-28  |  23KB  |  638 lines

  1. {$N+,E+}  (*  $N+ compiles for 80x87 which is used                 *)
  2.           (*  automatically if available.  E+ activates the        *)
  3.           (*  80X87 emulator which will be used if a coprocessor   *)
  4.           (*  is not present.  I understand that these are program *)
  5.           (*  wide options and cannot be used in a unit separately *)
  6.  
  7. (*  Written by Dan Glanz, Alexandria, Virginia (76672,2572), May, 1989. *)
  8. (*  as a public service.                                                *)
  9. (*  There are no restrictions on use and no gaurantees that it works.   *)
  10.  
  11. (*    All I ask is a smidgeon of credit.                          *)
  12. (*  If you include this in a program, leave the credit line in. *)
  13. (*  If you modify the unit, add your own credit line.           *)
  14.  
  15. (*    This is a Turbo Pascal 5.0 unit designed to allow reading and writing
  16.     of Lotus 1-2-3,    Symphony, VP-Planner and other such files using the
  17.     Lotus 1-2-3    file format.
  18.  
  19.               ************** update information  ***************
  20.  
  21.     This version is updated to allow reading and writing of range names and
  22.     extents and column widths.  The structure of the "Lotus_Record_Type" has
  23.     been modified to variant records for efficiency in data storage.
  24.  
  25.               **************************************************
  26.  
  27.     Lotus 1-2-3 uses 8 byte reals (TP's double's).  Any program using
  28.     Lotus 1-2-3 data must either use a math coprocessor {$N+} or
  29.     coprocessor emulation {$N+,E+}
  30.  
  31.     For demonstration purposes, a separate program called TEST123
  32.     is included in the ARC file.
  33.  
  34.     It reads any Lotus format file and copies out label, integer, real
  35.     column width, range identification and the current value of formula cells
  36.     to a file in the same directory with the same name but with an extension
  37.     of '.WK!'  It does not copy formulas and other such information.
  38.     It is primarily designed to allow access to the DATA.  However, it
  39.     does read column widths, and range names and extents.
  40.  
  41.     Take note that Lotus rows and columns are numbered starting with 0.
  42.     that is Column A is 0 and Row 1 is 0.
  43.  
  44.     Lotus_Version is set up as a typed constant as if the file were
  45.     a Lotus version 1.0 or 1a type file.  Change it if you need to.
  46.     The program automatically writes a version record at the beginning of
  47.     the file when the file is opened for writing by calling
  48.     Open_Lotus_Write_File.  It must do this or Lotus 1-2-3 will not
  49.     allow use of the file.  If you have used Open_Lotus_Read_File to open
  50.     a file to be copied or accessed, then the version of that file is
  51.     substituted for the default Lotus_Version.
  52.  
  53.     If you want to use the unit to create a Lotus formatted file directly,
  54.     you must provide the row and column of the data in Lotus.Row and
  55.     Lotus.Column (starting with row 0 and column 0), define the format
  56.     in Lotus.Format (default seems to be 255) set the value in either
  57.     Lotus.Integer_Value, Lotus.Real_Value, Lotus.Column_Width, or
  58.     Lotus.Range_Name, Range_Start Column, etc., or Lotus.Label_Value.
  59.     Then set Lotus.Cell_Type := to Integer_Type, Real_Type, Column_Width_Type,
  60.     RAnge_Type or Label_Type as the case may be    and call Write_Lotus_Record.
  61.  
  62.     Note: When you write your own labels in Label_Value, make sure you put
  63.     a ' or " or ^ as the first character of the string.  Also, you may be
  64.     able to include formulas in a worksheet you are creating by writing out
  65.     a label cell containing with the formula and then deleting
  66.     the ', ", or ^ in the spreadsheet itself, perhaps by using a macro.
  67.  
  68.     When you call Close_Lotus_Write_File, an end of file record is written
  69.     and the file is automatically closed.
  70.  
  71.     Lotus 1-2-3 is a trademark of Lotus Corporation.
  72.  
  73. *)
  74.  
  75. Unit Unit123;
  76. Interface
  77.  
  78. uses crt, dos;
  79.  
  80. Const
  81.     Lotus_Version : integer = 1028;  {1028 for Lotus 1}
  82.                                      {1029 for Symphony 1.0}
  83.                                      {1030 for Lotus 2 & Symphony 1.1}
  84.  
  85. Type
  86.     Lotus_Cell_Type = (Version_Type, End_Of_File_Type, Blank_Type,
  87.                        Integer_Type, Real_Type, Label_Type,
  88.                        Formula_Type, Unidentified_Type, Range_Type,
  89.                        Column_Width_Type);
  90.  
  91.     Lotus_Record_Type =
  92.         Record
  93.             Cell_Type_Code    : Integer;
  94.             Cell_Length        : Integer;
  95.             Format            : Byte;
  96.             Column            : integer;
  97.             Row                : integer;
  98.             Cell_Type       : Lotus_Cell_Type;
  99.             Alpha_Column    : String[8];
  100.             case integer of
  101.                  8:   (Column_Width       : Byte);
  102.                  11:  (Range_Name         : string[16];
  103.                        Range_Start_Column : integer;
  104.                        Range_Start_Row    : integer;
  105.                        Range_End_Column   : integer;
  106.                        Range_End_Row      : integer;
  107.                        Alpha_Range_Start  : string;
  108.                        Alpha_Range_End    : String);
  109.                  13:  (Integer_Value      : integer);
  110.                  14:  (Real_Value          : double);
  111.                  15:  (Label_Value          : string;
  112.                        Zero                  : byte);
  113.                  16:  (Formula_Value      : double;
  114.                        Formula_Length     : integer;
  115.                        Formula              : array [0 .. 255] of byte);
  116.                  255: (Unidentified       : array [0 .. 511] of byte);
  117.         end;
  118. var
  119.     Lotus_Read_File_Name    : PathStr;
  120.     Lotus_Read_File_DirStr  : DirStr;
  121.     Lotus_Read_File_NameStr : NameStr;
  122.     Lotus_Read_File_ExtStr  : ExtStr;
  123.  
  124.     Lotus_Read_File         : file;
  125.  
  126.     Lotus_Write_File_Name    : PathStr;
  127.     Lotus_Write_File        : file;
  128.  
  129.     Lotus_End_Of_File        : boolean;
  130.     Lotus_Version_Name        : string;
  131.  
  132.     Lotus                    : Lotus_Record_Type;
  133.  
  134. Procedure Get_Input_File_Name;
  135. Procedure Open_Lotus_Read_File;
  136. Procedure Get_Version_Name;
  137. Procedure Get_Alpha_Column(var Alpha_Column_ID : String; Column_Number, Row_Number:integer);
  138. Procedure Read_Type_and_Length;
  139. Procedure Read_Format_Info;
  140. Procedure Read_Lotus_Record;
  141. Procedure Print_Lotus_Record;
  142. Procedure Close_Lotus_Read_File;
  143.  
  144. Procedure Make_New_File_Name;
  145. Procedure Open_Lotus_Write_File;
  146. Procedure Write_Type_and_Length;
  147. Procedure Write_Format_Info;
  148. Procedure Write_Lotus_Record;
  149. Procedure Close_Lotus_Write_File;
  150.  
  151. implementation
  152.  
  153. (****************************************************************)
  154.  
  155. Procedure Get_Input_File_Name;    {Solicits the input file name from }
  156.                                   {the console.  If the extension is }
  157.                                   {ommitted, it substitutes .WKS }
  158.  
  159. begin
  160.     Write('Enter name of Lotus File ');    {Get the file path name}
  161.     Readln(Lotus_Read_File_Name);
  162.     FSplit(Lotus_Read_File_Name,Lotus_Read_File_DirStr,
  163.         Lotus_Read_File_NameStr,Lotus_Read_File_ExtStr);
  164.     If Lotus_Read_File_ExtStr = '' then Lotus_Read_File_ExtStr := '.WKS';
  165.     Lotus_Read_File_Name := Lotus_Read_File_DirStr + Lotus_Read_File_NameStr +
  166.         Lotus_Read_File_ExtStr;
  167. end;
  168.  
  169.  
  170.  
  171. (****************************************************************)
  172.  
  173. Procedure Read_Type_and_Length;    {Could be changed to a single }
  174.                                    {BlockRead since Cell_Type_Code}
  175.                                    {Cell_Length are adjacent in the record}
  176.                                    {definition and on the file.}
  177. begin
  178.     BlockRead(Lotus_Read_File, Lotus.Cell_Type_Code, 2);
  179.     BlockRead(Lotus_Read_File, Lotus.Cell_Length,    2);
  180.  
  181. {   OPTIONAL}
  182. {   BlockRead(Lotus_Read_File, Lotus.Cell_Type_Code, 4);   }
  183.  
  184. end;
  185.  
  186. (****************************************************************)
  187.  
  188. Procedure Write_Type_and_Length;        {Could be changed to a single }
  189.                                         {BlockWrite since format, column}
  190.                                         {and row are adjacent in the record}
  191.                                         {definition and on the file.}
  192. begin
  193.     BlockWrite(Lotus_Write_File, Lotus.Cell_Type_Code, 2);
  194.     BlockWrite(Lotus_Write_File, Lotus.Cell_Length,    2);
  195.  
  196. {   OPTIONAL}
  197. {   BlockWrite(Lotus_Write_File, Lotus.Cell_Type_Code, 4);   }
  198.  
  199. end;
  200.  
  201. (****************************************************************)
  202.  
  203. Procedure Get_Alpha_Column(var Alpha_Column_ID : String; Column_Number, Row_Number:integer);
  204. Var
  205.    First_Char : char;
  206.    Second_Char : char;
  207.    Row_String  : string[6];
  208. Begin
  209.    First_Char := char(64 + Column_Number div 26);
  210.    Second_Char := char(65 + Column_Number -((byte(First_Char)-64) * 26));
  211.    If First_Char = #64 then First_Char := #32;
  212.    Str(Row_Number + 1, Row_String);
  213.    Alpha_Column_ID := First_Char + Second_Char + Row_String;
  214. end;
  215.  
  216.  
  217. (****************************************************************)
  218.  
  219. Procedure Read_Format_Info;             {Could be changed to a single }
  220.                                         {BlockRead since format, column}
  221.                                         {and row are adjacent in the record}
  222.                                         {definition and on the file.}
  223. Var
  224.     Alpha_Column_ID : string;
  225.  
  226. begin
  227.     BlockRead(Lotus_Read_File, Lotus.Format, 1);
  228.     BlockRead(Lotus_Read_File, Lotus.Column, 2);
  229.     BlockRead(Lotus_Read_File, Lotus.Row,    2);
  230.  
  231. {   OPTIONAL}
  232. {   BlockRead(Lotus_Read_File, Lotus.Format, 5);   }
  233.  
  234.     Get_Alpha_Column(Alpha_Column_ID, Lotus.Column, Lotus.Row);
  235.     Lotus.Alpha_Column := Alpha_Column_ID;
  236.  
  237. end;
  238.  
  239. (****************************************************************)
  240.  
  241. Procedure Write_Format_Info;            {Could be changed to a single }
  242.                                         {BlockWrite since format, column}
  243.                                         {and row are adjacent in the record}
  244.                                         {definition and on the file.}
  245. begin
  246.     BlockWrite(Lotus_Write_File, Lotus.Format, 1);
  247.     BlockWrite(Lotus_Write_File, Lotus.Column, 2);
  248.     BlockWrite(Lotus_Write_File, Lotus.Row,    2);
  249.  
  250. {   OPTIONAL}
  251. {   BlockWrite(Lotus_Write_File, Lotus.Format, 5);   }
  252.  
  253. end;
  254.  
  255. (****************************************************************)
  256.  
  257. Procedure Open_Lotus_Read_File;
  258. begin
  259. {$I-}
  260.     Assign(Lotus_Read_File,Lotus_Read_File_Name);
  261.     Reset(Lotus_Read_File,1);
  262.     If IoResult <> 0 then
  263.         begin
  264.             Writeln('Error opening file ', Lotus_Read_File_Name);
  265.             halt;
  266.         end;
  267. {$I+}
  268.      Read_Lotus_Record;                      {Read the first record}
  269.                                              {If the first record is}
  270.                                              {not a Version_Type record}
  271.                                              {then this is not a Lotus File}
  272.  
  273.     If Lotus.Cell_Type <> Version_Type then
  274.        begin
  275.             Writeln('This is not a Lotus File');
  276.             Halt
  277.        end;
  278.  
  279.     Lotus_End_Of_File := false;
  280. end;
  281.  
  282. (****************************************************************)
  283.  
  284. Procedure Open_Lotus_Write_File;
  285. begin
  286. {$I-}
  287.     Assign(Lotus_Write_File,Lotus_Write_File_Name);
  288.     ReWrite(Lotus_Write_File,1);
  289.     If IoResult <> 0 then
  290.         begin
  291.             Writeln('Error opening file ', Lotus_Write_File_Name);
  292.             halt;
  293.         end;
  294. {$I+}
  295.  
  296. { Automatically write a version type record at the beginning of the file }
  297. { Lotus_Version is a typed constant set to Version 1.0 or 1A by default  }
  298. { If you have used Open_Lotus_File to read another Lotus file, then it   }
  299. { will have already read the version type record from the input file     }
  300.  
  301.     Lotus.Cell_Type_Code := 0;
  302.     Lotus.Cell_Length    := 2;
  303.     Write_Type_and_Length;
  304.     BlockWrite(Lotus_Write_File,Lotus_Version,2);
  305.  
  306. end;
  307.  
  308. (****************************************************************)
  309.  
  310. Procedure Close_Lotus_Read_File;
  311. begin
  312.     Close(Lotus_Read_File);
  313. end;
  314.  
  315. (****************************************************************)
  316.  
  317. Procedure Close_Lotus_Write_File;
  318. begin
  319. { Write an end of file record at the end of the file }
  320.     Lotus.Cell_Type_Code := 1;
  321.     Lotus.Cell_Length    := 0;
  322.     Write_Type_and_Length;            {End the file with a type 1 record}
  323.     Close(Lotus_Write_File);
  324. end;
  325.  
  326. (****************************************************************)
  327.  
  328. Procedure Get_Version_Name;
  329. begin
  330.     Case Lotus_Version of
  331.         1028:
  332.             Lotus_Version_Name := 'Lotus 1-2-3 Version 1.0 or 1A';
  333.         1029:
  334.             Lotus_Version_Name := 'Symphony Version 1.0';
  335.         1030:
  336.             Lotus_Version_Name := 'Lotus 1-2-3 Version 2.0, 2.1 or Symphony Version 1.1';
  337.         Else
  338.             Lotus_Version_Name := 'Unidentified';
  339.     end;
  340. end;
  341.  
  342. (****************************************************************)
  343.  
  344. Procedure Read_Lotus_Record;
  345.  
  346. var
  347.     Alpha_Column_ID : string;
  348.  
  349. begin
  350.     FillChar(Lotus, SizeOf(Lotus), #0);
  351.     Read_Type_and_Length;
  352.  
  353.     Case Lotus.Cell_Type_Code of
  354.  
  355.         0:  begin                             {Version Record}
  356.                                               {There should be only one}
  357.                                               {record of this type and it}
  358.                                               {will normally be read when}
  359.                                               {you call Open_Lotus_Read_File}
  360.  
  361.                 Lotus.Cell_Type := Version_Type;
  362.                 BlockRead(Lotus_Read_File, Lotus_Version, 2);
  363.                 Get_Version_Name;
  364.             end;
  365.  
  366.         1:  begin                                        {End of File}
  367.                 Lotus.Cell_Type := End_Of_File_Type;
  368.                 Lotus_End_of_File := True;
  369.             end;
  370.  
  371.         8:                                               {Column width type}
  372.             begin
  373.                 Lotus.Cell_Type := Column_Width_Type;
  374.                 BlockRead(Lotus_Read_File, Lotus.Column, 2);
  375.                 BlockRead(Lotus_Read_File, Lotus.Column_Width,1);
  376.                 Get_Alpha_Column(Alpha_Column_ID, Lotus.Column, 0);
  377.                 Lotus.Alpha_Column := Alpha_Column_ID;
  378.             end;
  379.  
  380.         11: begin                                        {Range definition}
  381.                 Lotus.Cell_Type := Range_Type;
  382.                 BlockRead(Lotus_Read_File, Lotus.Range_Name[1],16);
  383.                 Lotus.Range_Name[0] := Char(16);
  384.                 BlockRead(Lotus_Read_File, Lotus.Range_Start_Column,2);
  385.                 BlockRead(Lotus_Read_File, Lotus.Range_Start_Row,2);
  386.                 BlockRead(Lotus_Read_File, Lotus.Range_End_Column,2);
  387.                 BlockRead(Lotus_Read_File, Lotus.Range_End_Row,2);
  388.                 Get_Alpha_Column(Alpha_Column_ID, Lotus.Range_Start_Column,
  389.                         Lotus.Range_Start_Row);
  390.                 Lotus.Alpha_Range_Start := Alpha_Column_ID;
  391.                 Get_Alpha_Column(Alpha_Column_ID, Lotus.Range_End_Column,
  392.                         Lotus.Range_End_Row);
  393.                 Lotus.Alpha_Range_End := Alpha_Column_ID;
  394.              end;
  395.  
  396.         12: begin                                        {Blank Record}
  397.                 Lotus.Cell_Type := Blank_Type;
  398.                 Read_Format_Info;
  399.             end;
  400.  
  401.         13: begin                                         {Integer}
  402.                 Lotus.Cell_Type := Integer_Type;
  403.                 Read_Format_Info;
  404.                 BlockRead(Lotus_Read_File, Lotus.Integer_Value, 2);
  405.             end;
  406.  
  407.         14: begin                                         {Real Value}
  408.                 Lotus.Cell_Type := Real_Type;
  409.                 Read_Format_Info;
  410.                 BlockRead(Lotus_Read_File, Lotus.Real_Value, 8);
  411.             end;
  412.  
  413.         15: begin                                         {Label}
  414.                 Lotus.Cell_Type := Label_Type;
  415.                 Read_Format_Info;
  416.                 If Lotus.Cell_Length > 261 then
  417.                     begin
  418.                        Writeln('Big problem! Label at Row', Lotus.Row, ' Column ', Lotus.Column, ' has length > 255');
  419.                        Halt;
  420.                     end;
  421.                 BlockRead(Lotus_Read_File, Lotus.Formula, Lotus.Formula_Length);
  422.                 BlockRead(Lotus_Read_File, Lotus.Label_Value[1], Lotus.Cell_Length - 6);
  423.                 Lotus.Label_Value[0] := char(Lotus.Cell_Length - 6);
  424.                 BlockRead(Lotus_Read_File, Lotus.Zero, 1);
  425.             end;
  426.  
  427.         16: begin                                         {Formula}
  428.                 Lotus.Cell_Type := Formula_Type;
  429.                 Read_Format_Info;
  430.                 BlockRead(Lotus_Read_File, Lotus.Formula_Value, 8);
  431.                 BlockRead(Lotus_Read_File, Lotus.Formula_Length, 2);
  432.                 If Lotus.Formula_Length > 255 then
  433.                     begin
  434.                        Writeln('Big problem! Formula cell at Row', Lotus.Row, ' Column ', Lotus.Column, ' has length > 255');
  435.                        Halt;
  436.                     end;
  437.                 BlockRead(Lotus_Read_File, Lotus.Formula, Lotus.Formula_Length);
  438.             end;
  439.  
  440.         Else                                              {Unidentified}
  441.             begin
  442.                 Lotus.Cell_Type := Unidentified_Type;
  443.  
  444.             {    Use the following line only if you are sure that the length }
  445.             {    of the unidentified data type is less than 512 characters.  }
  446.             {    I the unidentified data cell is more than 512 byte long,    }
  447.             {    it could cream the program by overwriting code.             }
  448.             {    The check on cell length protects against this. But,        }
  449.             {    if you don't know the maximum cell length, the safest       }
  450.             {    approach is the approach I have taken, just skip the        }
  451.             {    unknown data cell                                           }
  452.             {                                                                }
  453.             {    If Lotus.Cell_Length > 512 then                             }
  454.             {        begin                                                   }
  455.             {           Writeln('Big problem! Cell at row ', Lotus.Row, ' Column ', Lotus.Coulmn, ' has  length > 512');   }
  456.             {           Halt;                                                }
  457.             {        end;                                                    }
  458.             {                                                                }
  459.             {    BlockRead (Lotus_Read_File, Lotus.Unidentified , Lotus.Cell_Length);}
  460.  
  461.  
  462.             {    This is the safest way.}
  463.  
  464.                 Seek(Lotus_Read_File, FilePos(Lotus_Read_File) + Lotus.Cell_Length);
  465.  
  466.             end;
  467.         end;
  468. end;
  469.  
  470. (****************************************************************)
  471.  
  472. Procedure Print_Lotus_Record;
  473. begin
  474.     If Lotus.Cell_Type = Blank_Type then exit;  {If you really want to}
  475.                                                 {show all of the blank}
  476.                                                 {records, delete this line}
  477.     Writeln;
  478.     Case Lotus.Cell_Type of
  479.  
  480.         Version_Type:
  481.             Writeln(Lotus_Version_Name, ' Id Code = ',Lotus_Version);
  482.  
  483.         End_Of_File_Type:
  484.             Writeln('End of File');
  485.  
  486.         Column_Width_Type:
  487.             Writeln('Column ', Lotus.Alpha_Column , ' Width = ' , Lotus.Column_Width);
  488.  
  489.         Range_Type:
  490.             begin
  491.                 Writeln('Lotus Range Cell');
  492.                 Write(' Range Name = ', Lotus.Range_Name);
  493.                 Write(' Range Start = ', Lotus.Alpha_Range_Start);
  494.                 Writeln(' Range End = ', Lotus.Alpha_Range_End);
  495.             end;
  496.  
  497.         Blank_Type:
  498.             begin
  499.                 Write('Lotus Cell ', Lotus.Alpha_Column);
  500.                 Write(' Format = ', Lotus.Format);
  501.                 Writeln(' Blank Cell');
  502.             end;
  503.  
  504.         Integer_Type:
  505.             begin
  506.                 Write('Lotus Cell ', Lotus.Alpha_Column);
  507.                 Write(' Format = ', Lotus.Format);
  508.                 Writeln(' Integer = ', Lotus.Integer_Value);
  509.             end;
  510.  
  511.         Real_Type:
  512.             begin
  513.                 Write('Lotus Cell ', Lotus.Alpha_Column);
  514.                 Write(' Format = ', Lotus.Format);
  515.                 Writeln(' Real = ', Lotus.Real_Value);
  516.             end;
  517.  
  518.         Label_Type:
  519.             begin
  520.                 Write('Lotus Cell ', Lotus.Alpha_Column);
  521.                 Write(' Format = ', Lotus.Format);
  522.                 Writeln(' Label = ', Lotus.Label_Value);
  523.             end;
  524.  
  525.         Formula_Type:
  526.             begin
  527.                 Write('Lotus Cell ', Lotus.Alpha_Column);
  528.                 Write(' Format = ', Lotus.Format);
  529.                 Writeln(' Formula Value = ', Lotus.Formula_Value);
  530.             end;
  531.  
  532.         End_Of_File_Type:
  533.             Writeln('End of file detected.');
  534.  
  535.         Unidentified_Type:
  536.             begin
  537.                 Writeln('Unidentified Cell. OpCode = ', Lotus.Cell_Type_Code,
  538.                 ' Length = ', Lotus.Cell_Length);
  539.             end;
  540.  
  541.         Else
  542.             begin
  543.                 Writeln(' Unidentified Cell. OpCode = ', Lotus.Cell_Type_Code);
  544.             end;
  545.         end;
  546.  
  547. end;
  548.  
  549. (****************************************************************)
  550.  
  551. Procedure Write_Lotus_Record;
  552.  
  553. begin
  554.     Case Lotus.Cell_Type of
  555.  
  556.         Column_Width_Type:
  557.             begin
  558.                 Lotus.Cell_Type_Code := 8;
  559.                 Lotus.Cell_Length := 3;
  560.                 Write_Type_and_Length;
  561.                 BlockWrite(Lotus_Write_File , Lotus.Column, 2);
  562.                 BlockWrite(Lotus_Write_File , Lotus.Column_Width, 1);
  563.             end;
  564.  
  565.         Range_Type:
  566.             begin
  567.                 Lotus.Cell_Type_Code := 11;
  568.                 Lotus.Cell_Length := 24;
  569.                 Write_Type_and_Length;
  570.                 BlockWrite(Lotus_Write_File,Lotus.Range_Name[1], 16);
  571.                 BlockWrite(Lotus_Write_File,Lotus.Range_Start_Column,2);
  572.                 BlockWrite(Lotus_Write_File,Lotus.Range_Start_Row,2);
  573.                 BlockWrite(Lotus_Write_File,Lotus.Range_End_Column,2);
  574.                 BlockWrite(Lotus_Write_File,Lotus.Range_End_Row,2);
  575.             end;
  576.  
  577.         Blank_Type:
  578.             Exit;
  579.  
  580.         Integer_Type:
  581.             begin
  582.                 Lotus.Cell_Type_Code := 13;
  583.                 Lotus.Cell_Length := 7;
  584.                 Write_Type_and_Length;
  585.                 Write_Format_Info;
  586.                 BlockWrite(Lotus_Write_File,Lotus.Integer_Value,2);
  587.             end;
  588.  
  589.         Real_Type:
  590.             begin
  591.                 Lotus.Cell_Type_Code := 14;
  592.                 Lotus.Cell_Length := 13;
  593.                 Write_Type_and_Length;
  594.                 Write_Format_Info;
  595.                 BlockWrite(Lotus_Write_File,Lotus.Real_Value,8);
  596.             end;
  597.  
  598.         Label_Type:
  599.             begin
  600.                 Lotus.Cell_Type_Code := 15;
  601.                 Lotus.Cell_Length := 6 + Length(Lotus.Label_Value);
  602.                 Lotus.Zero := 0;
  603.                 Write_Type_and_Length;
  604.                 Write_Format_Info;
  605.                 BlockWrite(Lotus_Write_File,Lotus.Label_Value[1],Length(Lotus.Label_Value));
  606.                 BlockWrite(Lotus_Write_File,Lotus.Zero, 1);
  607.             end;
  608.  
  609.         Formula_Type:    {NOTE: ONLY COPIES OUT THE CURRENT VALUE AS A REAL}
  610.                          { If you want to copy the formula then also       }
  611.                          { BlockWrite Lotus.Formula_Value.                 }
  612.                          { See Read_Lotus_File for how to interpret length }
  613.                          { Also, you must change the Cell_Type_Code to 16  }
  614.             begin
  615.                 Lotus.Cell_Type_Code := 14;
  616.                 Lotus.Cell_Length := 13;
  617.                 Write_Type_and_Length;
  618.                 Write_Format_Info;
  619.                 BlockWrite(Lotus_Write_File,Lotus.Formula_Value,8);
  620.             end;
  621.  
  622.         Else
  623.             begin
  624.             end;
  625.         end;
  626. end;
  627.  
  628. (****************************************************************)
  629.  
  630. Procedure Make_New_File_Name;
  631.  
  632. begin
  633.     Lotus_Write_File_Name := Lotus_Read_File_DirStr + Lotus_Read_File_NameStr +
  634.          '.WK!';
  635. end;
  636.  
  637. begin
  638. end.